home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
listings
/
v_11_05
/
1105100a
< prev
next >
Wrap
Text File
|
1993-03-07
|
671b
|
34 lines
/* copy5.c */
#include <stdio.h>
#include <stdlib.h>
main(int argc, char *argv[])
{
if (argc == 3)
{
char buf[BUFSIZ];
FILE *inf, *outf;
if ((inf = fopen(argv[1],"rb")) == NULL)
return EXIT_FAILURE;
if ((outf = fopen(argv[2],"wb")) == NULL)
return EXIT_FAILURE;
while (!feof(inf))
{
int nitems = fread(buf,1,BUFSIZ,inf);
if (fwrite(buf,1,nitems,outf) != nitems)
return EXIT_FAILURE;
}
fclose(inf);
fclose(outf);
return EXIT_SUCCESS;
}
else
return EXIT_FAILURE;
}